<template>
  <div id="app">
    <el-container>
      <!--头部 开始-->
      <el-header style="text-align: center; font-size: 18px;">
        足彩分析系统
      </el-header>
      <!--头部 结束-->

      <!--内容 开始-->
      <el-container style="height: 650px; border: 1px solid #eee">

        <!--左侧容器--列表 开始-->
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
          <el-menu :default-openeds="['1','2','3']" @select="menuChange">
            <!--列表模块1 开始-->
            <el-submenu index="1">
              <template slot="title"><i class="el-icon-s-grid"></i>基础信息</template>
              <el-menu-item-group>
                <el-menu-item index="1-1">路径配置</el-menu-item>
                <el-menu-item index="1-2">入库配置</el-menu-item>
                <el-menu-item index="1-3">彩票公司</el-menu-item>
                <el-menu-item index="1-4">联赛信息</el-menu-item>
                <el-menu-item index="1-5">杯赛信息</el-menu-item>
                <el-menu-item index="1-6">联赛数据</el-menu-item>
                <el-menu-item index="1-7">杯赛数据</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!--列表模块1 结束-->

            <!--列表模块2 开始-->
            <el-submenu index="2">
              <template slot="title"><i class="el-icon-s-grid"></i>盘口/胜率</template>
              <el-menu-item-group>
                <el-menu-item index="2-1">让球盘口分析结果</el-menu-item>
                <el-menu-item index="2-2">大小盘口分析结果</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!--列表模块2 结束-->

            <!--列表模块3 开始-->
            <el-submenu index="3">
              <template slot="title"><i class="el-icon-s-grid"></i>盘口/胜率</template>
              <el-menu-item-group>
                <el-menu-item index="3-1">导出盘口数据</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!--列表模块3 结束-->
          </el-menu>
        </el-aside>
        <!--左侧容器--列表 结束-->

        <!--右侧容器--内容模块 开始-->
        <el-main>
          <!--路径配置 开始-->
          <el-table v-if="tagIndex=='1-1'" :data="configArr">
            <el-table-column prop="id" label="id"></el-table-column>
            <el-table-column prop="path" label="python采集生成文件路径"></el-table-column>
            <el-table-column prop="sleep" label="python采集文件间隔（秒）"></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button size="small" type="primary" icon="el-icon-edit" title="编辑" @click="switchPath"></el-button>
              </template>
            </el-table-column>
          </el-table>
          <!--路径配置 结束-->

          <!--入库配置 开始-->
          <el-table v-if="tagIndex=='1-2'" :data="typeInfoArr" stripe>
            <el-table-column prop="id" label="id"></el-table-column>
            <el-table-column label="python采集">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.iscollect"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('typeinfo',scope.row.id,'iscollect',scope.row.iscollect)">
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column label="python入库">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.isinsert"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('typeinfo',scope.row.id,'isinsert',scope.row.isinsert)">
                </el-switch>
              </template>
            </el-table-column>
          </el-table>
          <!--入库配置 结束-->

          <!--彩票公司信息 开始-->
          <el-table v-if="tagIndex=='1-3'" :data="companyInfoArr" stripe>
            <el-table-column prop="id" label="id"></el-table-column>
            <el-table-column prop="companyname" label="公司名称"></el-table-column>
            <el-table-column label="python采集">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.enable"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('companyinfo',scope.row.id,'enable',scope.row.enable)">
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column prop="ispop" label="主流公司">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.ispop"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="非主流"
                    active-text="主 流"
                    @change="switchInfo('companyinfo',scope.row.id,'ispop',scope.row.ispop)">
                </el-switch>
              </template>
            </el-table-column>
          </el-table>
          <!--彩票公司信息 结束-->

          <!--联赛信息 开始-->
          <el-table v-if="tagIndex=='1-4'" :data="leagueInfoArr" stripe>
            <el-table-column prop="leagueid" label="联赛id"></el-table-column>
            <el-table-column prop="leaguetype" label="联赛类型"></el-table-column>
            <el-table-column prop="enable" label="python采集">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.enable"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('leagueinfo',scope.row.id,'enable',scope.row.enable)">
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column prop="iscollect" label="采集状态">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.iscollect"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="未采集"
                    active-text="已采集"
                    @change="switchInfo('leagueinfo',scope.row.id,'iscollect',scope.row.iscollect)">
                </el-switch>
              </template>
            </el-table-column>
          </el-table>
          <!--联赛信息 结束-->

          <!--杯赛信息 开始-->
          <el-table v-if="tagIndex=='1-5'" :data="cupInfoArr" stripe>
            <el-table-column prop="cupid" label="杯赛id"></el-table-column>
            <el-table-column prop="cuptype" label="杯赛类型"></el-table-column>
            <el-table-column prop="enable" label="python采集">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.enable"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('cupinfo',scope.row.id,'enable',scope.row.enable)">
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column prop="iscollect" label="采集状态">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.iscollect"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="未采集"
                    active-text="已采集"
                    @change="switchInfo('cupinfo',scope.row.id,'iscollect',scope.row.iscollect)">
                </el-switch>
              </template>
            </el-table-column>
          </el-table>
          <!--杯赛信息 结束-->

          <!--联赛数据 开始-->
          <el-table v-if="tagIndex=='1-6'" :data="seasonInfoArr" stripe>
            <el-table-column prop="id" label="id"></el-table-column>
            <el-table-column prop="season" label="赛季"></el-table-column>
            <el-table-column prop="enable" label="python采集">
              <template slot-scope="scope">
                <!-- 苹果开关 -->
                <el-switch
                    v-model="scope.row.enable"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="1"
                    :inactive-value="0"
                    inactive-text="关"
                    active-text="开"
                    @change="switchInfo('seasoninfo',scope.row.id,'enable',scope.row.enable)">
                </el-switch>
              </template>
            </el-table-column>
          </el-table>
          <!--联赛数据 结束-->

          <!--杯赛数据 开始-->
          <div v-if="tagIndex=='1-7'">
            <!--分页 结束-->
            <div style="margin-top: 10px">
              <div align="right">
                <el-pagination
                    small
                    background
                    layout="prev, pager, next, jumper, total"
                    :current-page="currentPage"
                    :page-size="pageSize"
                    :total="totalCount"
                    @current-change="handleCurrentChange">
                </el-pagination>
              </div>
            </div>
            <!--分页 结束-->

            <el-table :data="matchInfoArr" stripe>
              <el-table-column type="index" label="序"></el-table-column>
              <el-table-column prop="matchtype" label="联赛"></el-table-column>
              <el-table-column prop="type" label="盘">
                <template slot-scope="scope">
                  <span v-if="scope.row.type=='one'">亚</span>
                  <span v-if="scope.row.type=='two'">大</span>
                  <span v-if="scope.row.type=='three'">欧</span>
                </template>
              </el-table-column>
              <el-table-column prop="matchdate" label="日期">
                <template slot-scope="scope">
                <span style="color: blue">
                  {{scope.row.matchdate}} {{scope.row.h}}:{{scope.row.i}}
                </span>
                </template>
              </el-table-column>
              <el-table-column prop="season" label="赛季"></el-table-column>
              <el-table-column prop="hometeam" label="主队"></el-table-column>
              <el-table-column prop="guestteam" label="客队"></el-table-column>
              <el-table-column prop="rounds" label="轮次" align="center"></el-table-column>
              <el-table-column prop="begin" label="主水"></el-table-column>
              <el-table-column prop="pan" label="盘口"></el-table-column>
              <el-table-column prop="end" label="客水"></el-table-column>
              <el-table-column label="完场">
                <template slot-scope="scope"><span style="color: red">{{scope.row.eh}}-{{scope.row.eg}}</span></template>
              </el-table-column>
              <el-table-column label="中场">
                <template slot-scope="scope"><span>{{scope.row.hh}}-{{scope.row.hg}}</span></template>
              </el-table-column>
            </el-table>

            <!--分页 结束-->
            <div style="margin-top: 10px">
              <div align="right">
                <el-pagination
                    small
                    background
                    layout="prev, pager, next, jumper, total"
                    :current-page="currentPage"
                    :page-size="pageSize"
                    :total="totalCount"
                    @current-change="handleCurrentChange">
                </el-pagination>
              </div>
            </div>
            <!--分页 结束-->
          </div>
          <!--杯赛数据 结束-->

          <!--让球统计概率 开始-->
          <div v-if="tagIndex=='2-1' || tagIndex=='2-2' || tagIndex=='2-3'">
            <div style="margin: 0 0 10px 0;">盘口分析结果</div>
            <template>
              <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="联赛类型" name="first">
                  <template>
                    <el-checkbox :indeterminate="isIndeterminate1" v-model="checkAllLeagues" @change="CheckAllLeagueChange">全选</el-checkbox>
                    <div style="margin: 15px 0;"></div>
                    <el-checkbox-group v-model="checkedLeagues" @change="CheckedLeagueChange">
                      <el-checkbox style="margin-top: 20px" v-for="league in leagueInfoArr" :label="league.leaguetype">{{league.leaguetype}}</el-checkbox>
                    </el-checkbox-group>
                  </template>
                </el-tab-pane>
                <el-tab-pane label="联赛赛季" name="second">
                  <template>
                    <el-checkbox :indeterminate="isIndeterminate2" v-model="checkAllSeasons" @change="CheckAllSeasonChange">全选</el-checkbox>
                    <div style="margin: 15px 0;"></div>
                    <el-checkbox-group v-model="checkedSeasons" @change="CheckedSeasonChange">
                      <el-checkbox style="margin-top: 20px" v-for="season in seasonInfoArr" :label="season.season">{{season.season}}</el-checkbox>
                    </el-checkbox-group>
                  </template>
                </el-tab-pane>
                <el-tab-pane label="博彩公司" name="third">
                  <template>
                    <el-checkbox :indeterminate="isIndeterminate3" v-model="checkAllCompanys" @change="CheckAllCompanyChange">全选</el-checkbox>
                    <div style="margin: 15px 0;"></div>
                    <el-checkbox-group v-model="checkedCompanys" @change="CheckedCompanyChange">
                      <el-checkbox style="margin-top: 20px" v-for="company in companyInfoArr" :label="company.companyname">{{company.companyname}}</el-checkbox>
                    </el-checkbox-group>
                  </template>
                </el-tab-pane>
                <el-tab-pane :label="statisticsTitle" name="fourth">
                  <template>
                    <el-checkbox :indeterminate="isIndeterminate4" v-model="checkAllOdds" @change="CheckAllOddsChange">全选</el-checkbox>
                    <div style="margin: 15px 0;"></div>
                    <el-checkbox-group v-model="checkedOdds" @change="CheckedOddsChange">
                      <el-checkbox style="margin-top: 20px" v-for="odds in oddsInfoArr" :label="odds.odds">{{odds.odds}}</el-checkbox>
                    </el-checkbox-group>
                  </template>
                </el-tab-pane>
              </el-tabs>
            </template>

            <br>
            <br>
            <div align="center"><el-button type="primary" size="mini" @click="searchData()">按条件查询</el-button></div>

            <br>
            <br>

            <!--统计 开始-->
            <div v-if="statistics=='one' || statistics=='two' || statistics=='three'">
              <el-row>
              <el-col :span="24">
                <div>
                  <span class="statistics">联赛类型：</span><span class="info">{{searchResultArr.leaguetypes}} </span>
                  <span class="statistics">赛季：</span><span class="info">{{searchResultArr.seasons}} </span>
                  <span class="statistics">博彩公司：</span><span class="info">{{searchResultArr.companynames}} </span>
                  <span class="statistics">初盘：</span><span class="info">{{searchResultArr.oddss}} </span>
                  <span class="statistics">终盘：</span>
                </div>
              </el-col>
            </el-row>
              <br>
              <el-row>
                <el-col :span="24">
                  <div>
                    <span class="statistics">盘口总场次：</span><span class="info">{{searchResultArr.total}} </span>
                    <span class="statistics">上盘：</span><span class="info">{{searchResultArr.winTotal}} </span>
                    <span class="statistics">走盘：</span><span class="info">{{searchResultArr.drawTotal}} </span>
                    <span class="statistics">下盘：</span><span class="info">{{searchResultArr.loseTotal}} </span>
                    <span class="statistics">赢盘率：</span><span style="color: red"></span><span class="info">{{searchResultArr.wow}}% </span>
                    <span class="statistics">输盘率：</span><span style="color: red"></span><span class="info">{{searchResultArr.low}}% </span>
                  </div>
                </el-col>
              </el-row>

              <br>
              <hr color="red">
              <br>
            </div>
            <!--统计 结束-->

            <!--显示赛事信息 开始-->
            <div v-if="statistics=='one'">
              <template>
              <el-table :data="searchResultArr.matchListOne" stripe>
                <el-table-column type="index" label="序"></el-table-column>
                <el-table-column prop="pageid" label="pageid" width="80">
                  <template slot-scope="scope">
                    <a :href="'http://vip.titan007.com/AsianOdds_n.aspx?id='+scope.row.pageid+'&t=0&l=1'" target="_blank">{{scope.row.pageid}}</a>
                  </template>
                </el-table-column>
                <el-table-column prop="season" label="赛季" width="90"></el-table-column>
                <el-table-column prop="leaguetype" label="类型"></el-table-column>
                <el-table-column prop="rounds" label="轮" align="center"></el-table-column>
                <el-table-column prop="matchdatetime" label="时间" width="200"></el-table-column>
                <el-table-column prop="r1" label="主排"></el-table-column>
                <el-table-column prop="hometeam" label="主队" width="200"></el-table-column>
                <el-table-column prop="eh" label="比">
                  <template slot-scope="scope">
                    <span class="info">{{scope.row.eh}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="eg" label="分">
                  <template slot-scope="scope">
                    <span class="info">{{scope.row.eg}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="guestteam" label="客队" width="200"></el-table-column>
                <el-table-column prop="r2" label="客排"></el-table-column>
                <el-table-column prop="odds" label="初盘">
                  <template slot-scope="scope">
                    <span :title="scope.row.companyname" v-if="scope.row.tagone==-1">{{scope.row.odds}}</span>
                    <span :title="scope.row.companyname" v-if="scope.row.tagone==0"><img src="./assets/yes-draw.png">{{scope.row.odds}}</span>
                    <span :title="scope.row.companyname" v-if="scope.row.tagone==1"><img src="./assets/yes-one.png">{{scope.row.odds}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="升/同/降"></el-table-column>
                <el-table-column label="终盘"></el-table-column>
                <el-table-column label="当前胜率">
                  <template slot-scope="scope">
                    <span class="info">{{scope.row.currentwow}}%</span>
                  </template>
                </el-table-column>
              </el-table>
            </template>
            </div>
            <!--显示赛事信息 结束-->

            <!--显示赛事信息 开始-->
            <div v-if="statistics=='two'">
              <template>
                <el-table :data="searchResultArr.matchListTwo" stripe>
                  <el-table-column type="index" label="序"></el-table-column>
                  <el-table-column prop="pageid" label="pageid" width="80">
                    <template slot-scope="scope">
                      <a :href="'http://vip.titan007.com/AsianOdds_n.aspx?id='+scope.row.pageid+'&t=0&l=1'" target="_blank">{{scope.row.pageid}}</a>
                    </template>
                  </el-table-column>
                  <el-table-column prop="season" label="赛季" width="90"></el-table-column>
                  <el-table-column prop="leaguetype" label="类型"></el-table-column>
                  <el-table-column prop="rounds" label="轮" align="center"></el-table-column>
                  <el-table-column prop="matchdatetime" label="时间" width="200"></el-table-column>
                  <el-table-column prop="r1" label="主排"></el-table-column>
                  <el-table-column prop="hometeam" label="主队" width="200"></el-table-column>
                  <el-table-column prop="eh" label="比">
                    <template slot-scope="scope">
                      <span class="info">{{scope.row.eh}}</span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="eg" label="分">
                    <template slot-scope="scope">
                      <span class="info">{{scope.row.eg}}</span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="guestteam" label="客队" width="200"></el-table-column>
                  <el-table-column prop="r2" label="客排"></el-table-column>
                  <el-table-column prop="odds" label="初盘">
                    <template slot-scope="scope">
                      <span :title="scope.row.companyname" v-if="scope.row.tagtwo==-1">{{scope.row.odds}}</span>
                      <span :title="scope.row.companyname" v-if="scope.row.tagtwo==0"><img src="./assets/yes-draw.png">{{scope.row.odds}}</span>
                      <span :title="scope.row.companyname" v-if="scope.row.tagtwo==1"><img src="./assets/yes-one.png">{{scope.row.odds}}</span>
                    </template>
                  </el-table-column>
                  <el-table-column label="升/同/降"></el-table-column>
                  <el-table-column label="终盘"></el-table-column>
                  <el-table-column label="当前胜率">
                    <template slot-scope="scope">
                      <span class="info">{{scope.row.currentwow}}%</span>
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </div>
            <!--显示赛事信息 结束-->
          </div>
          <!--让球统计概率 结束-->



        </el-main>
        <!--右侧容器--内容模块 结束-->
      </el-container>

      <!--抽屉组件 开始-->
      <el-drawer title="路径配置" :visible.sync="drawerConfig" direction="ttb" size="40%">
        <el-form>
          <el-form-item label-width="80px">
            生成路径：<el-input style="width: 300px" v-model="path" size="small"></el-input>
            <br>
            采集间隔：<el-input style="width: 100px" v-model="sleep" size="small"></el-input>
            <br>
            <el-button type="success" size="small" @click="updateConfig">更新配置</el-button>
          </el-form-item>
        </el-form>
      </el-drawer>
      <!--抽屉组件 结束-->

      <!--内容 结束-->
    </el-container>
    <router-view/>
  </div>
</template>

<style>
  *{
    margin: 0;
  }
.el-header {
  background-color: #0070CA;
  color: #fff;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>

<script>
export default {

  data() {
    //配置信息
    let configArr = [];

    //入库配置
    let typeInfoArr = [];

    //公司信息
    let companyInfoArr = [];

    //联赛信息
    let leagueInfoArr = [];

    //杯赛信息
    let cupInfoArr = [];

    //赛季信息
    let seasonInfoArr = [];

    //赛事信息
    let matchInfoArr = [];

    //盘口信息
    let oddsInfoArr = [];

    //查询结果
    let searchResultArr = {};

    //分页参数
    const pageSize = 30;//每页记录数
    const totalCount = 0;//赛事总场次
    const currentPage = 1;//当前第几页
    const activeName = 'first';//选项卡的位置

    //抽屉功能
    const drawerConfig = false;

    //路径配置
    const path = '';
    const sleep = 0;

    const statistics = '';
    const statisticsTitle = '';

    //多选操作
    const checkAllLeagues = false;
    const checkedLeagues = [];
    const isIndeterminate1 = true;

    const checkAllSeasons = false;
    const checkedSeasons = [];
    const isIndeterminate2 = true;

    const checkAllCompanys = false;
    const checkedCompanys = [];
    const isIndeterminate3 = true;

    const checkAllOdds = false;
    const checkedOdds = [];
    const isIndeterminate4 = true;

    const len1 = 0;
    const len2 = 0;
    const len3 = 0;
    const len4 = 0;

    return {
      tagIndex:"1-1",//内容模块标签
      configArr,
      typeInfoArr,
      companyInfoArr,
      leagueInfoArr,
      cupInfoArr,
      seasonInfoArr,
      matchInfoArr,
      oddsInfoArr,
      searchResultArr,
      pageSize,
      totalCount,
      currentPage,
      drawerConfig,//抽屉开关标识
      path,
      sleep,
      statistics,
      statisticsTitle,
      activeName,

      //选择联赛类型多选
      checkAllLeagues,
      checkedLeagues,
      isIndeterminate1,

      //选择联赛赛季多选
      checkAllSeasons,
      checkedSeasons,
      isIndeterminate2,

      //选择博彩公司多选
      checkAllCompanys,
      checkedCompanys,
      isIndeterminate3,

      //选择盘口多选
      checkAllOdds,
      checkedOdds,
      isIndeterminate4,


      //默认搜索条件
      form:{
        region:'',
        type:'',
        leaguetypes:'',
        season:'',
        companynames:'',
        odds:'',
      }
    }
  },

  methods:{
    /***************************多选搜索功能 开始***************************/
    //选择联赛类型
    CheckAllLeagueChange(val) {
      let self = this;
      var arr = [];

      for(var i=0;i<self.leagueInfoArr.length;i++){
        arr[i] = self.leagueInfoArr[i].leaguetype;
      }
      self.checkedLeagues = val ? arr : [];
      self.isIndeterminate1 = false;

      if (self.checkedLeagues.length == 0){
        self.len1 = 0;
      }else{
        self.len1 = 1;
      }
    },

    CheckedLeagueChange(value) {
      let self = this;
      var checkedCount = value.length;
      self.checkAllLeagues = checkedCount === self.checkedLeagues.length;
      self.isIndeterminate1 = checkedCount > 0 && checkedCount < self.checkedLeagues.length;

      if (checkedCount == 0){
        self.len1 = 0;
      }else{
        self.len1 = 1;
      }
    },

    //选择联赛赛季多选
    CheckAllSeasonChange(val) {
      let self = this;
      var arr = [];

      for(var i=0;i<self.seasonInfoArr.length;i++){
        arr[i] = self.seasonInfoArr[i].season;
      }
      self.checkedSeasons = val ? arr : [];
      self.isIndeterminate2 = false;

      if (self.checkedSeasons.length == 0){
        self.len2 = 0;
      }else{
        self.len2 = 1;
      }
    },

    CheckedSeasonChange(value) {
      let self = this;
      var checkedCount = value.length;
      self.checkAllSeasons = checkedCount === self.checkedSeasons.length;
      self.isIndeterminate2 = checkedCount > 0 && checkedCount < self.checkedSeasons.length;

      if (checkedCount == 0){
        self.len2 = 0;
      }else{
        self.len2 = 1;
      }
    },

    //选择博彩公司多选
    CheckAllCompanyChange(val) {
      let self = this;
      var arr = [];

      for(var i=0;i<self.companyInfoArr.length;i++){
        arr[i] = self.companyInfoArr[i].companyname;
      }
      self.checkedCompanys = val ? arr : [];
      self.isIndeterminate3 = false;

      if (self.checkedCompanys.length == 0){
        self.len3 = 0;
      }else{
        self.len3 = 1;
      }
    },

    CheckedCompanyChange(value) {
      let self = this;
      var checkedCount = value.length;
      self.checkAllCompanys = checkedCount === self.checkedCompanys.length;
      self.isIndeterminate3 = checkedCount > 0 && checkedCount < self.checkedCompanys.length;

      if (checkedCount == 0){
        self.len3 = 0;
      }else{
        self.len3 = 1;
      }
    },

    //选择盘口多选
    CheckAllOddsChange(val) {
      let self = this;
      var arr = [];

      for(var i=0;i<self.oddsInfoArr.length;i++){
        arr[i] = self.oddsInfoArr[i].odds;
      }
      self.checkedOdds = val ? arr : [];
      self.isIndeterminate4 = false;

      if (self.checkedOdds.length == 0){
        self.len4 = 0;
      }else{
        self.len4 = 1;
      }
    },

    CheckedOddsChange(value) {
      let self = this;
      var checkedCount = value.length;
      self.checkAllOdds = checkedCount === self.checkedOdds.length;
      self.isIndeterminate4 = checkedCount > 0 && checkedCount < self.checkedOdds.length;

      if (checkedCount == 0){
        self.len4 = 0;
      }else{
        self.len4 = 1;
      }
    },
    /***************************多选搜索功能 结束***************************/

    //切换选项卡
    handleClick(tab, event) {
      console.log(tab, event);
    },

    //搜索结果
    searchData(){
      let self = this;

      if(self.statistics=='one' || self.statistics=='two' || self.statistics=='three'){
        if(self.len1 == 1 && self.len2 == 1 && self.len3 == 1 && self.len4 == 1){
          this.axios.post("/api/20002/match/list/search",{
            type:self.statistics,
            leaguetypes: self.checkedLeagues,
            seasons: self.checkedSeasons,
            companynames: self.checkedCompanys,
            oddss: self.checkedOdds,
          }).then(function (response) {
            self.searchResultArr = response.data.data;
          });
        }else{
          this.$message.error('请补齐搜索条件！');
        }
      }
    },

    //更新配置信息
    updateConfig(){
      let self = this;
      let id = self.configArr[0].id;
      let path = self.path;
      let sleep = self.sleep;

      this.axios.post("/api/20001/info/configinfo/update",{
        id:id,
        path:path,
        sleep:sleep
      }).then(function (response) {
        self.drawerConfig = false;
      })
    },

    //点击菜单，调到对应内容
    menuChange(index){
      let self = this;
      self.tagIndex = index;
      if(index == '2-1'){
        self.statistics = 'one';
        self.statisticsTitle = '让球盘口';
        this.loadOddsInfo('one');//获取盘口信息
      }else if(index == '2-2'){
        self.statistics = 'two';
        self.statisticsTitle = '大小盘口';
        this.loadOddsInfo('two');//获取盘口信息
      }else if(index == '2-3'){
        self.statistics = 'three';
        self.statisticsTitle = '欧指盘口';
        this.loadOddsInfo('three');//获取盘口信息
      }
    },

    //通过type,id,value修改info表的值
    switchInfo(type,id,field,value){
      this.axios.post('/api/20001/info/update',{
        type:type,
        id:id,
        field:field,
        value:value
      })
    },

    //抽屉：路径配置
    switchPath(){
      let self = this;
      self.drawerConfig = true;
    },

    //获取配置信息
    loadConfigInfo(){
      let self = this;
      //获取路径配置
      this.axios.get("/api/20001/info/configinfo/list").then(function (response) {
        self.configArr = response.data.data;
        self.path = response.data.data[0].path;
        self.sleep = response.data.data[0].sleep;
      })
    },

    //获取入库配置
    loadTypeInfo(){
      let self = this;
      this.axios.get("/api/20001/info/typeinfo/list").then(function (response) {
        self.typeInfoArr = response.data.data
      })
    },

    //获取公司信息
    loadCompanyInfo(){
      let self = this;
      this.axios.get("/api/20001/info/companyinfo/list").then(function (response) {
        self.companyInfoArr = response.data.data
      })
    },

    //获取联赛信息
    loadLeagueInfo(){
      let self = this;
      this.axios.get("/api/20001/info/leagueinfo/list").then(function (response) {
        self.leagueInfoArr = response.data.data;
      })
    },

    //获取杯赛信息
    loadCupInfo(){
      let self = this;
      this.axios.get("/api/20001/info/cupinfo/list").then(function (response) {
        self.cupInfoArr = response.data.data;
      })
    },

    //获取盘口信息
    loadOddsInfo(type){
      let self = this;
      this.axios.get("/api/20001/info/oddsinfo/list/type/" + type).then(function (response) {
        self.oddsInfoArr = response.data.data
      });
    },

    //获取赛事信息
    loadMatchInfo(){
      let self = this;
      this.axios.get("/api/20002/match/list/page/" + self.currentPage + "/pagesize/" + self.pageSize).then(function (response) {
        self.matchInfoArr = response.data.data.list;
        self.totalCount = response.data.data.totalCount;
        self.currentPage = response.data.data.pageNum;
        self.pageSize = response.data.data.pageSize;
      })
    },

    //分页，参数current_page代表当前页
    handleCurrentChange(current_page){
      let self = this;
      self.currentPage = current_page;
      self.loadMatchInfo();
    }
  },

  //初始化配置
  created() {
    //获取配置信息
    this.loadConfigInfo();
    this.loadTypeInfo();//获取入库配置
    this.loadCompanyInfo();//获取公司信息
    this.loadLeagueInfo();//获取联赛信息
    this.loadCupInfo();//获取杯赛信息
    this.loadMatchInfo();//获取赛事信息
  }
};
</script>

<style>
.statistics{
  color: blue;
}
.info{
  color: #dd524d;
}
</style>